﻿Compare = function (ID) {
    window.location = "http://" + location.host + "/SoSanh.aspx?ID1=" + ID;
}

ThemVaoGioHang = function (ID, SL) {
    var html = '<div class="ms-dlgOverlay" style="display: block; z-index: 1504; width: 1280px; height: 603px;"></div>';
    $("body").append(html);
    if (SL == undefined)
        SL = 1;
    $.ajax({
        url: "CS.aspx",
        data: "ID=" + ID + "&SL=" + SL,
        success: function (response) {
            if (response != false) {
                var retu = response.split(";")
                $(".ThongTinDatHang").html(retu[0]);
                $(".TongTien").html(retu[1] + " VNĐ");
                $(".TongSP").html(retu[2] + " Sản Phẩm");
                window.location = "GioHang.aspx";
            }
            $(".ms-dlgOverlay").remove();
        }
    });
}

Compare = function (ID) {
    alert(ID);
    window.location = "http://" + location.host + "/SoSanh.aspx?ID1=" + ID;
}

ThemVaoYeuThich = function (ID) {
    $.ajax({
        url: "AjaxLogin.aspx?CheckLogin=1",
        success: function (data) {
            if (data == "True") {
                $.ajax({
                    url: "CS.aspx?InsertWish=1&IDSP=" + ID,
                    success: function (Result) {
                        if (Result) {
                            window.location = "SanPhamYeuThich.aspx";
                        }
                    }
                })
            }
            else {
                $("#formDangNhap").dialog("open");
                sessionStorage.YeuThich = 1;
            }
        }
    })
}